import { request } from './request'

export const pageGoal = (params: App.PageGoalParams): Promise<App.PageResponse<App.GoalItem>> => {
  return request({
    method: 'post',
    data: params,
    url:'/goal/page'
  })
}

export const addOrUpdateGoal = (params: App.GoalItem):Promise<App.ResponseCore>=>{
  return request({
    method: 'post',
    data: params,
    url:'/goal/addOrUpdate'
  })
}

export const detailGoal = (params: App.DetailParams):Promise<App.GoalItem> => {
  return request({
    method: 'get',
    params,
    url:"/goal/detail"
  })
}

export const deleteGoal = (params: App.DetailParams): Promise<App.ResponseCore> => {
  return request({
    method: 'get',
    params,
    url:'/goal/delete'
  })
}

export const pushGoal = (params: App.GoalPushParams): Promise<App.ResponseCore> => {
  return request({
    method: "post",
    data: params,
    url:'/goal/push'
  })
}


export const updateContent = (params: App.GoalContentParams): Promise<App.ResponseCore> => {
  return request({
    method: 'post',
    data: params,
    url:'/goal/content'
  })
}


export const getGoalList = (): Promise<{ id: number, title: string }[]> => {
  return request({
    method: 'get',
    url: '/goal/list'
  })
}